﻿using System;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace Common
{
    public enum MaturityStages
    {
        NewArticle = 0,
        UpdatedArticle = 1,
        OnVerification = 2,
        SentForReview = 3,
        OnReview = 4,
        ReviewCreated = 5,
        RejectedArticle = 6,
        SentForRevision =7,
        AddedToPortfolio = 8,
        AddedToIssuePlan = 9,
        RemovedFromIssuePlan = 10
    }

    [DataContract]
    public class Article : HsePSObject
    {
        public Article()
        {
            ID = Guid.NewGuid().ToString();
            CreationTime = DateTime.Now;
            ModificationTime = DateTime.Now;
            Name = this.GetType().Name;
        }

        [DataMember]
        public string ID { get; private set; }
        [DataMember]
        public DateTime ModificationTime { get; private set; }
        [DataMember]
        public DateTime CreationTime { get; private set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string Tags { get; set; }
        [DataMember]
        public string Text { get; set; }
        [DataMember]
        public string AuthorID { get; set; }
        [DataMember]
        public string ArticleEditor { get; set; }
        [DataMember]
        public string ArticleReviewer { get; set; }
        [DataMember]
        public string AttachmentID { get; set; }
        [DataMember]
        public MaturityStages Stage 
        { 
            get { return (MaturityStages)status; }
            set 
            {
                this.ModificationTime = DateTime.Now;
                status = (int)value; 
            } 
        }
        public int status { get; private set; }
    }
}